<template>
   <!--物资管理-物资列表-详情列表-修改出库弹窗-->
  <j-modal
    :title="title"
    :width="1000"
    :visible="visible"
    :maskClosable="false"
    switchFullscreen
    @ok="handleOk"
    :okButtonProps="{ class:{'jee-hidden': disableSubmit} }"
    @cancel="handleCancel"
    cancelText="关闭">
    <wt-materials-gai-form v-if="id !== ''" ref="realForm" @ok="submitCallback" :disabled="disableSubmit" :id="this.id" />
  </j-modal>
</template>

<script>

  import WtMaterialsGaiForm from './WtMaterialsGaiForm'

  export default {
    name: 'WtMaterialsModal',
    components: {
      WtMaterialsGaiForm
    },
    props:{
      id: {
        type: String
      }
    },
    data() {
      return {
        title:'',
        width:800,
        id: '',
        visible: false,
        disableSubmit: false
      }
    },
    created(){
      console.log('gfdhd',this.id);
    },
    mounted() {

    },
    methods:{
      add () {
        this.visible=true
        this.$nextTick(()=>{
          this.$refs.realForm.add();
        })
      },
      edit(record) {
        this.visible=true
        this.$nextTick(()=>{
          this.$refs.realForm.edit(record);
        })
      },
      close () {
        this.$emit('close');
        this.visible = false;
      },
      handleOk () {
        this.$refs.realForm.submitForm();
      },
      submitCallback(){
        this.$emit('ok');
        this.visible = false;
      },
      handleCancel () {
        this.close()
      }
    }
  }
</script>

<style scoped>
</style>